package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsCustomerGroupReportsIncidentsDetailedPageUtil extends SeleniumPageUtil {
	public final static By RCGRID_LINK_VIEW_REPORT = By.id("ctl44_btnSearch");
	public final static By RCGRID_SPAN_INCIDENTS_BY_CUSTOMER_GROUP = By.id("ctl44_lblReportName");
	public final static By RCGRID_SPAN_HEADER = By.id("ctl44_lblHdr");
	public final static By RCGRID_SPAN_SELECT_CUSTOMER = By.id("ctl44_lblPrompt");
	public final static By RCGRID_INPUT_SELECT_CUSTOMER = By.id("ctl44_txtCustomer");
	public final static By RCGRID_TD_BETWEEN = By.xpath("//*[@id='ctl44_trDates']/td[1]");
	public final static By RCGRID_INPUT_START = By.id("ctl44_txtStart");
	public final static By RCGRID_TD_AND = By.xpath("//*[@id='ctl44_trDates']/td[2]");
	public final static By RCGRID_IMG_START = By.id("ctl44_imgStart");
	public final static By RCGRID_INPUT_END = By.id("ctl44_txtStop");
	public final static By RCGRID_IMG_END = By.id("ctl44_imgStop");
	
	public static void enterReportsCustomerGroupReportsIncidentsDetailedPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
//		SmsSeleniumUtil.click(SmsSeleniumUtil.getCachedElement(SmsReportsDefaultPageUtil.RD_LINK_INCIDENTS_DETAILED));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RCGRID_LINK_VIEW_REPORT, RCGRID_IMG_START, RCGRID_IMG_END 
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCGRID_LINK_VIEW_REPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCGRID_IMG_START));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RCGRID_IMG_END));
	}
}
